package com.yyx.app1.DiagnosticTools_function.Control.ViewPager.ViewPagerItemControl.firstControl;

import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.widget.Button;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.ListView;

import com.yyx.app1.DiagnosticTools_function.UI.NineFunction_Activity.DiagnosticTools_CommonlyUsedFormulas_EighthFunction_Activity_;
import com.yyx.app1.DiagnosticTools_function.UI.NineFunction_Activity.DiagnosticTools_CommonlyUsedFormulas_FifthFunction_Activity_;
import com.yyx.app1.DiagnosticTools_function.UI.NineFunction_Activity.DiagnosticTools_CommonlyUsedFormulas_FirstFunction_Activity_;
import com.yyx.app1.DiagnosticTools_function.UI.NineFunction_Activity.DiagnosticTools_CommonlyUsedFormulas_FourthFunction_Activity_;
import com.yyx.app1.DiagnosticTools_function.UI.NineFunction_Activity.DiagnosticTools_CommonlyUsedFormulas_NinthFunction_Activity_;
import com.yyx.app1.DiagnosticTools_function.UI.NineFunction_Activity.DiagnosticTools_CommonlyUsedFormulas_SecondFunction_Activity_;
import com.yyx.app1.DiagnosticTools_function.UI.NineFunction_Activity.DiagnosticTools_CommonlyUsedFormulas_SeventhFunction_Activity_;
import com.yyx.app1.DiagnosticTools_function.UI.NineFunction_Activity.DiagnosticTools_CommonlyUsedFormulas_ThreeFunction_Activity_;
import com.yyx.app1.DiagnosticTools_function.UI.NineFunction_Activity.DiagnosticTools_CommonlyUsedFormulas_sixthFunction_Activity_;
import com.yyx.app1.R;

import org.androidannotations.annotations.AfterViews;
import org.androidannotations.annotations.Click;
import org.androidannotations.annotations.EViewGroup;
import org.androidannotations.annotations.ItemClick;
import org.androidannotations.annotations.ViewById;
import org.androidannotations.annotations.res.ColorRes;

/**
 * Created by yuexing on 2015/9/9.
 */
@EViewGroup(R.layout.view_viewpager_diagnostic_firstchildview)
public class CommonlyUsedFormulas_View extends LinearLayout {
    private Context context;
    private String[] functions = new String[]{"尿比重", "输血量", "碳酸氢钠补充量", "血清钙", "渗透压计算", "脱水量", "白蛋白的缺乏量", "钾离子补充", "犬静脉营养"};
    private int[] images = new int[]{R.drawable.button1, R.drawable.button2, R.drawable.button3, R.drawable.button4, R.drawable.button5, R.drawable.button6, R.drawable.button7, R.drawable.button8, R.drawable.button9};
    private Object[] classes;
    private int[] backgroud = new int[]{R.drawable.yuanjiao_ico_appcolor,R.drawable.yuanjiao_ico_blue,R.drawable.yuanjiao_ico_green,R.drawable.yuanjiao_ico_red,
            R.drawable.yuanjiao_ico_yello,R.drawable.yuanjiao_ico_appcolor,R.drawable.yuanjiao_ico_blue,R.drawable.yuanjiao_ico_yello,R.drawable.yuanjiao_ico_red};

    @ViewById
    ListView viewpager_first_listview;

    @ColorRes
    int bottom_meun_font_color;

    public CommonlyUsedFormulas_View(Context context) {
        super(context);
        this.context = context;
    }

    public CommonlyUsedFormulas_View(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public CommonlyUsedFormulas_View(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        this.context = context;
    }

    @AfterViews
    public void init() {
        First_ViewPager_ListView_Apater apater = new First_ViewPager_ListView_Apater(context);
        apater.findAll(functions, images,backgroud);
        viewpager_first_listview.setAdapter(apater);
        viewpager_first_listview.setOverScrollMode(OVER_SCROLL_NEVER);
        classes = new Object[]{DiagnosticTools_CommonlyUsedFormulas_FirstFunction_Activity_.class, DiagnosticTools_CommonlyUsedFormulas_SecondFunction_Activity_.class,
                DiagnosticTools_CommonlyUsedFormulas_ThreeFunction_Activity_.class, DiagnosticTools_CommonlyUsedFormulas_FourthFunction_Activity_.class,
                DiagnosticTools_CommonlyUsedFormulas_FifthFunction_Activity_.class, DiagnosticTools_CommonlyUsedFormulas_sixthFunction_Activity_.class,
                DiagnosticTools_CommonlyUsedFormulas_SeventhFunction_Activity_.class, DiagnosticTools_CommonlyUsedFormulas_EighthFunction_Activity_.class,
                DiagnosticTools_CommonlyUsedFormulas_NinthFunction_Activity_.class};
    }

    @ItemClick(R.id.viewpager_first_listview)
    public void myListItemClicked(int position) {
        Intent intent = new Intent(context, (Class<?>) classes[position]);
        context.startActivity(intent);
    }
}